package org.cmroot.certmaster.client;

import com.google.gwt.logging.client.LogConfiguration;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Copyright (c) 2010 Andrey Domas <andrey.domas at gmail.com>.
 * *
 * This file is part of certmaster.
 * *
 * Certmaster is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * *
 * Certmaster is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see http://www.gnu.org/licenses
 * or write to the Free Software Foundation,Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301  USA
 */

public abstract class BaseScreen extends Composite  {

    private Logger logger = Logger.getLogger("Client");

    protected void cLog(String msg) {
        logger.log(Level.SEVERE, msg);
    }

    protected void cLog(Throwable e) {
        if (LogConfiguration.loggingIsEnabled()) {
            cLog(e.getClass().toString() + ": " + e.getMessage());
        }
    }

    protected void showLabel(Label label, String text) {
        label.setText(text);
        label.setVisible(true);
    }

    protected void hideLabel(Label label) {
        label.setVisible(false);
        label.setText("");
    }

}
